package com.showsu.editor.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: William
 * @Description: 套餐等级枚举
 * @Date: Created in 4:28 下午 2024/9/18
 * @Modified By:
 */
@Getter
@AllArgsConstructor
public enum VipLevelEnum {

    FREE(0, "免费用户", 1, 1, 1, 1, 1, false, true, false, 1,0,0,0),
    PE_1_MONTH(101, "个人版-1个月", 100, 100, 100, 100,100, false, true, true, 10,5000,50, 50),
    PE_3_MONTH(102, "个人版-3个月", 100, 100, 100, 100,100, false, true, true, 10,5000,50, 60),
    PE_6_MONTH(103, "个人版-6个月", 100, 100, 100, 100,100, false, true, true, 10,5000,50, 100),
    PE_12_MONTH(104, "个人版-12个月", 100, 100, 100, 100,100, false, true, true, 10,5000,50, 150),
    GE_1_MONTH(201, "团队版-1个月", 1000, 1000, 1000, 1000,1000, true, true, true, 100,10000,200, 300),
    GE_3_MONTH(202, "团队版-3个月", 1000, 1000, 1000, 1000,1000, true, true, true, 100,10000,200, 600),
    GE_6_MONTH(203, "团队版-6个月", 1000, 1000, 1000, 1000,1000, true, true, true, 100,10000,200, 1000),
    GE_12_MONTH(204, "团队版-12个月", 1000, 1000, 1000, 1000,1000, true, true, true, 100,10000,200, 1500),
    ;

    /**
     * 编码
     */
    final Integer code;

    /**
     * 描述
     */
    final String msg;

    /**
     * xhs live去水印 每日可用次数
     */
    final Integer xhsLive;

    /**
     * xhs评论区live去水印 每日可用次数
     */
    final Integer xhsCommentsLive;

    /**
     * 图片/视频去水印 每日可用次数
     */
    final Integer photoVideo;

    /**
     * GIF动图去水印 每日可用次数
     */
    final Integer gifPhoto;

    /**
     * 评论图片去水印 每日可用次数
     */
    final Integer commentPhoto;

    /**
     * 批量解析 是否可用
     */
    final Boolean batchParse;

    /**
     * 笔记编辑器 是否可用
     */
    final Boolean noteEditor;

    /**
     * 笔记配图上传 是否可用
     */
    final Boolean notePhotoUpload;

    /**
     * 笔记存储数量 每日可用次数
     */
    final Integer noteNum;

    /**
     * 笔记AI违禁词检测 每日可用字数
     */
    final Integer aiCheckText;

    /**
     * xhs笔记收录查询
     */
    final Integer xhsAwemeIncluded;

    /**
     * xhs笔记排名查询
     */
    final Integer xhsAwemeRank;

    private static Map<Integer, VipLevelEnum> vipLevelEnumMap = new HashMap<Integer, VipLevelEnum>() {
        {
            put(FREE.code, FREE);
            put(PE_1_MONTH.code, PE_1_MONTH);
            put(PE_3_MONTH.code, PE_3_MONTH);
            put(PE_6_MONTH.code, PE_6_MONTH);
            put(PE_12_MONTH.code, PE_12_MONTH);
            put(GE_1_MONTH.code, GE_1_MONTH);
            put(GE_3_MONTH.code, GE_3_MONTH);
            put(GE_6_MONTH.code, GE_6_MONTH);
            put(GE_12_MONTH.code, GE_12_MONTH);
        }
    };

    public static Map<Integer, VipLevelEnum> getVipLevelEnumMap() {
//        Map<Integer, VipLevelEnum> vipLevelEnumMap = new HashMap<>();
//        vipLevelEnumMap.put(FREE.code, FREE);
//        vipLevelEnumMap.put(PE_1_MONTH.code, PE_1_MONTH);
//        vipLevelEnumMap.put(PE_3_MONTH.code, PE_3_MONTH);
//        vipLevelEnumMap.put(PE_6_MONTH.code, PE_6_MONTH);
//        vipLevelEnumMap.put(PE_12_MONTH.code, PE_12_MONTH);
//        vipLevelEnumMap.put(GE_1_MONTH.code, GE_1_MONTH);
//        vipLevelEnumMap.put(GE_3_MONTH.code, GE_3_MONTH);
//        vipLevelEnumMap.put(GE_6_MONTH.code, GE_6_MONTH);
//        vipLevelEnumMap.put(GE_12_MONTH.code, GE_12_MONTH);
        return vipLevelEnumMap;
    }

    public static VipLevelEnum getByLevel(Integer limitLevel) {
        if (limitLevel != null) {
            VipLevelEnum vipLevelEnum = vipLevelEnumMap.get(limitLevel);
            if(vipLevelEnum != null){
                return vipLevelEnum;
            }
        }
        return FREE;
    }

}
